//hbasemain.go
package main

import (
	"fmt"
	"hbase"
	"strconv"
	"thrift"
	"time"
)

func main() {
	transport, _ := thrift.NewTSocket("localhost:32789")
	defer transport.Close()
	if err := transport.Open(); err != nil {
		return
	}

	protocol := thrift.NewTBinaryProtocol(transport, true, true)

	client := hbase.NewHbaseClientProtocol(transport, protocol, protocol)
	fmt.Println(time.Now().String())
	for i := 0; i < 100; i++ {

		str := "table" + strconv.Itoa(i)
		column := hbase.NewColumnDescriptor()
		column.Name = []byte("row" + strconv.Itoa(i))
		//	column
		coarr := []*hbase.ColumnDescriptor{column}
		client.CreateTable([]byte(str), coarr)
	}
	fmt.Println(time.Now().String())
	tableNames, _ := client.GetTableNames()
	// for i := 0; len(by) > i; i++ {
	// 	fmt.Println(string(by[i]))
	// }
	for _, btemp := range tableNames {
		fmt.Println(string(btemp))
	}

	// client.GetRows(Text("table101"), rows, attributes)

	//	client.GetTableRegions([]byte("tbasss")
	// client.
}
